package com.sh.shanhuo.adapter;

import android.app.Activity;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sh.shanhuo.R;
import com.sh.shanhuo.bean.PushListBean;

import java.util.List;

public class RecommendationAdapter extends BaseQuickAdapter<PushListBean.RowsBean, BaseViewHolder> {
    private final Activity activity;

    public RecommendationAdapter(Activity activity, List<PushListBean.RowsBean> rowsBeans) {
        super(R.layout.recommendation_view, rowsBeans);
        this.activity = activity;
    }

    @Override
    protected void convert(BaseViewHolder helper, PushListBean.RowsBean rowsBean) {
        TextView recommendationContent = helper.getView(R.id.recommendationContent);
        recommendationContent.setText(rowsBean.getDescription());
        TextView recommendationTime = helper.getView(R.id.recommendationTime);
        recommendationTime.setText(rowsBean.getUpdateTime());
        if (rowsBean.getRemark().equals("0")) {
            recommendationContent.setTextColor(activity.getResources().getColor(R.color.item_uncheck, null));
            recommendationTime.setTextColor(activity.getResources().getColor(R.color.item_uncheck, null));
        } else {
            recommendationContent.setTextColor(activity.getResources().getColor(R.color.black, null));
            recommendationTime.setTextColor(activity.getResources().getColor(R.color.notice_time, null));
        }
    }
}
